home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac SampleCode New for 1.6 / WorldRayPickSample / Source / WRay_Error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-20  |  1.3 KB  |  87 lines  |  [TEXT/CWIE]

  1. /* 
  2.  *    WRay_Error.c
  3.  *
  4.  *    QuickDraw 3D 1.6 Sample
  5.  *    Robert Dierkes
  6.  *
  7.  *     07/28/98    RDD        Created.
  8.  */
  9.  
  10. /*------------------*/
  11. /*    Include Files    */
  12. /*------------------*/
  13. #include "QD3D.h"
  14.  
  15. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  16. #include <Dialogs.h>
  17. #include <Strings.h>
  18. #include <TextUtils.h>
  19. #endif
  20.  
  21. #include "WRay_Main.h"    /* kStringRsrcID */
  22. #include "WRay_Error.h"
  23.  
  24.  
  25. /*------------------*/
  26. /*      Constants        */
  27. /*------------------*/
  28. #define    kErrorAlertRsrcID    129
  29.  
  30.  
  31. /*----------------------*/
  32. /*    Local Prototypes    */
  33. /*----------------------*/
  34.  
  35.  
  36. /*
  37.  *    QuickDraw3D_Exit
  38.  *
  39.  *    Displays C string in an alert box.
  40.  */
  41. void Error_Alert(
  42.     short        iconType,
  43.     char        *pMessage)
  44. {
  45.     GrafPtr        oldPort;
  46.     short        itemHit;
  47.  
  48.     if (pMessage == NULL)
  49.         return;
  50.  
  51.     /* Convert C string to Pascal */
  52.     c2pstr (pMessage);
  53.     ParamText ((ConstStr255Param) pMessage, NULL, NULL, NULL);
  54.  
  55.     GetPort (&oldPort);
  56.  
  57.     if (iconType == kStopIcon)
  58.         itemHit = StopAlert (kErrorAlertRsrcID, NULL);
  59.     else
  60.         itemHit = NoteAlert (kErrorAlertRsrcID, NULL);
  61.  
  62.     SetPort (oldPort);
  63.  
  64.     /* Restore C string */
  65.     p2cstr ((StringPtr) pMessage);
  66. }
  67.  
  68.  
  69. /*
  70.  *    QuickDraw3D_Exit
  71.  */
  72. Boolean Error_ShowMessage(
  73.     short        resStringIndex)
  74. {
  75.     Str255    notice;
  76.  
  77.     GetIndString (notice, kStringRsrcID, resStringIndex);
  78.     if (notice[0] > 0)
  79.     {
  80.         p2cstr (notice);
  81.         Error_Alert(kNoteIcon, (char *) notice);
  82.         return true;
  83.     }
  84.  
  85.     return false;
  86. }
  87.